package com.xsy.carRental.mapper;

import com.github.pagehelper.Page;
import com.xsy.carRental.dto.MaintenanceQueryDTO;
import com.xsy.carRental.entity.Maintenance;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface MaintenanceMapper {

    @Insert("insert into maintenance (vehicle_id,start_date,end_date,cost,description,created_at)" +
            "values (#{vehicleId},#{startDate},#{endDate},#{cost},#{description},#{createdAt})")
    void add(Maintenance maintenance);

    Page<Maintenance> SearchQuery(MaintenanceQueryDTO maintenanceQueryDTO);

    @Delete("delete from maintenance where maintenance_id=#{maintenanceId}")
    void delete(Integer maintenanceId);
}
